#include <iostream>
using namespace std;

#include <vector>
#include <algorithm>


void moveZeroes(vector<int>& nums)
{
    vector<int> tmp;
    int n = nums.size();
    tmp.resize(n);

    for (int i = 0, j = 0; j < n ;)
    {
        if (i < n)
        {
            if (nums[i] != 0)
                tmp[j++] = nums[i++];
            else
                ++i;
        }
        else
        {
            tmp[j++] = 0;
        }

    }
    
    for (int i = 0; i < n; i++)
    {
        nums[i] = tmp[i];
    }

}


int main2345()
{
    vector<int> nums{ 0,1,0,3,12 };
    moveZeroes(nums);

    for (const auto& e : nums)
    {
        cout << e << " ";
    }
    cout << endl;
    return 0;
}